/*
 * Author: nicolas.bredeche(@)lri.fr
 * Created on 20 janv. 2006
 * 
 */

package picoevo.gp.representation.logicoperators;

import java.util.ArrayList;

import picoevo.core.representation.Individual;
import picoevo.gp.representation.Element_Node_TreeGP;
import picoevo.gp.representation.Element_Node_TreeGP_Operator;
import picoevo.toolbox.Display;

public class Element_Node_TreeGP_Operator_NOT extends Element_Node_TreeGP_Operator {

	public Element_Node_TreeGP_Operator_NOT(Individual __individualOwner, ArrayList __elementLevelOperatorList) {
		super(__individualOwner, __elementLevelOperatorList);
		setArity(1);
		setDisplayValue("NOT");
	}

	/** perform a boolean NOT operation */
	@Override
	public boolean evaluateBoolean() {
		ArrayList list = this.getSuccessors();
		if (list.size() != this.getArity())
			Display.error("" + getClass().getName() + "::evaluate() - incorrect number of successors (" + list.size() + ")");
		return (!((Element_Node_TreeGP) list.get(0)).evaluateBoolean());
	}
}
